﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace Quan_Ly_Nha_Thuoc
{
    public partial class frmHoaDonNhap : DevComponents.DotNetBar.OfficeForm
    {
        public frmHoaDonNhap()
        {
            InitializeComponent();
        }

        private void btnThemHoaDonNhap_Click(object sender, EventArgs e)
        {
            dateNgayNhap.Enabled = true;
            txtGhiChu.Enabled = true;
            btnLuuHoaDonNhap.Enabled = true;
            btnSuaHoaDonNhap.Enabled = false;
            btnXoaHoaDonNhap.Enabled = false;
        }

        private void btnSuaHoaDonNhap_Click(object sender, EventArgs e)
        {
            dateNgayNhap.Enabled = true;
            txtGhiChu.Enabled = true;
            btnLuuHoaDonNhap.Enabled = true;
            btnThemHoaDonNhap.Enabled = false;
            btnXoaHoaDonNhap.Enabled = false;
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            dateNgayNhap.Enabled = false;
            dateNgayNhap.Text = Convert.ToDateTime(DateTime.Now).ToString();
            txtGhiChu.Enabled = false;
            txtGhiChu.Clear();
            btnLuuHoaDonNhap.Enabled = false;
            btnThemHoaDonNhap.Enabled = true;
            btnSuaHoaDonNhap.Enabled = true;
            btnXoaHoaDonNhap.Enabled = true;

        }

        private void btnThemCTHD_Click(object sender, EventArgs e)
        {
            if (cboMaHoaDon.SelectedText != "")
            {
                btnLuuCTHD.Enabled = true;
                btnSuaCTHD.Enabled = false;
                btnXoaCTHD.Enabled = false;
                cboTenThuoc.Enabled = true;
                numSoLuong.Enabled = true;
                numGiaNhap.Enabled = true;
            }
            else
                MessageBox.Show("Vui lòng chọn Mã hoá đơn");
        }

        private void btnSuaCTHD_Click(object sender, EventArgs e)
        {
            btnThemCTHD.Enabled = false;
            btnXoaCTHD.Enabled = false;
            cboTenThuoc.Enabled = true;
            numSoLuong.Enabled = true;
            numGiaNhap.Enabled = true;
        }

        private void btnHuyCTHD_Click(object sender, EventArgs e)
        {
            btnLuuCTHD.Enabled = false;
            btnThemCTHD.Enabled = true;
            btnSuaCTHD.Enabled = true;
            btnXoaCTHD.Enabled = true;
         
        }

    }
}